﻿
using System.Text;

namespace LxCFD
{
    public class TestMonitor : GeomAverageMonitor
    {
        public TestMonitor()
        {
            ScalarType = ScalarTypes.Temperature;
        }
        public override void RunMonitor()
        {
            foreach (var z in AppRes.FvMesh.Zones)
            {
                var array = z.CFDFields.GetArray(ScalarType);
                if (array == null) continue;
                StringBuilder mes = new StringBuilder();
                mes.Append($"zone:{z.name}  ");
                foreach (var f in z.BoundThreads)
                {
                    MultiThreads.RunCalTasks((taskIndex) =>
                    {
                        CalFaceValue(z, f, array, taskIndex);
                    });
                    ThreadsMath.GetSum(out double sum1, out double sum2, out double sum3);
                    mes.Append($"{f.name}:{sum1 / sum2}  ");
                }
                LxConsole.Info(mes.ToString());
            }
        }

    }

}
